/*
 * Copyright (c) ycq_work@163.com
 */

package com.mxg.blog.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mxg.blog.common.CqLogger;
import com.mxg.blog.entity.Skill;
import com.mxg.blog.mapper.SkillsMapper;
import com.mxg.blog.service.SkillService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: ycq_work@163.com
 * @DATE: 2023/7/23 11:33
 * 具体实现
 */
@Service
public class SkillServiceImpl extends ServiceImpl<SkillsMapper, Skill> implements SkillService {
    CqLogger logger = CqLogger.getInstance();

    private final SkillsMapper skillsMapper;

    public SkillServiceImpl(SkillsMapper skillsMapper) {
        this.skillsMapper = skillsMapper;
    }

    // 根据id查询
    @Override
    public Skill getSkillById(Integer id){
        return skillsMapper.getSkillById(id);
    }

    // 查询所有
    @Override
    public List<Skill> getSkills(Integer userId){
        return skillsMapper.getSkills(userId);
    }

    // 查询可显示所有
    public List<Skill> getSkillsFront(Integer userId){
        return skillsMapper.getSkillsFront(userId);
    }

    // 添加技能
    @Override
    public void addSkill(String skillContent, Integer userId){
        skillsMapper.addSkill(skillContent, userId);
    }

    // 删除技能
    @Override
    public void deleteSkill(Integer id){
        skillsMapper.deleteSkill(id);
    }

    // 更新技能
    @Override
    public void updateSkill(String skillContent, Integer id){
        skillsMapper.updateSkill(skillContent, id);
    }

    // 更新显示状态
    public void changeSkillStatus(Integer skillsStatus, Integer id){
        skillsMapper.changeSkillStatus(skillsStatus, id);
    }
}
